<!DOCTYPE>
<html>
<head>
    <title>代理会员添加</title>
    {{template "inc/mate.html" .}}
    {{template "inc/easyui_css.html" .}}
    {{template "inc/ie_supper.html" .}}
</head>
<body>
    <form id="ff" method="post" action="{{.baseUrl}}/agent/mem/addMem" class="easyui-form" data-options="novalidate:true,ajax:false" style="padding:30px 45px;">
        <div style="margin-bottom:20px; margin-left: -30px; margin-top: -15px">
            <a href="{{.baseUrl}}/agent/mem" class="easyui-linkbutton" style="width:100px;">返回列表</a>
        </div>
        <div style="margin-bottom:20px;">
            <fieldset style="border-width: 1px 0px 0px 0px; margin-left: -30px;">
                <legend>添加会员</legend>
            </fieldset>
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" name="memName" style="width:300px" data-options="label:'姓名:',required:true,validType:'memName',missingMessage:'姓名不可以为空',invalidMessage:'姓名必须是中文及两个字以上'" />
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-numberbox" name="memPhone" style="width:300px" data-options="label:'手机号:',required:true,validType:'mphone',missingMessage:'手机号不可以为空',invalidMessage:'手机号格式不正确'" />
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-datebox" name="memBirthDate" style="width:300px" data-options="label:'出生日期:',required:true,missingMessage:'出生日期不可以为空',invalidMessage:'出生日期格式不正确',editable:false" />
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" name="memWxCode" data-options="label:'微信号：',required:true,validType:'wxCode',missingMessage:'微信号不可以为空',invalidMessage:'微信号格式不正确'"  style="width:300px">
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" name="memQqCode" data-options="label:'QQ号：',required:true,validType:'qqCode',missingMessage:'QQ号不可以为空',invalidMessage:'QQ号格式不正确'"  style="width:300px">
        </div>
        <div style="margin-bottom:20px">
            <label class="textbox-label textbox-label-before" for="_easyui_textbox_input3" style="text-align: left; height: 30px; line-height: 30px;">性别：</label>

            <input type="radio" name="memSex" value="男" />男&nbsp;&nbsp;
            <input type="radio" name="memSex" value="女" checked="true" />女
            <!--<input class="easyui-switchbutton" name="memSex" data-options="onText:'男',offText:'女'" checked />-->
            &nbsp;&nbsp;&nbsp;&nbsp;
            <input class="easyui-numberspinner" value="0" name="memHeight" data-options="label:'身高：',increment:1,min:1,suffix:'cm ',required:true"  style="width:180px;">
            &nbsp;&nbsp;&nbsp;&nbsp;
            <label class="textbox-label textbox-label-before" for="_easyui_textbox_input3" style="text-align: left; height: 30px; line-height: 30px;">学历：</label>
            <select class="easyui-combobox" name="memEducation" data-options="labelPosition:'top',editable:false" style="width:80px;">
                <option value="初中">初中</option>
                <option value="高中">高中</option>
                <option value="中专">中专</option>
                <option value="大专">大专</option>
                <option value="本科">本科</option>
                <option value="硕士">硕士</option>
                <option value="博士">博士</option>
            </select>
        </div>
        <div style="margin-bottom: 20px;">
            <input class="easyui-textbox" name="memJob" style="width:300px" data-options="label:'工作:',required:true,validType:'memName',missingMessage:'工作不可以为空',invalidMessage:'工作必须是中文及两个字以上'" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input class="easyui-numberspinner" value="0" name="memIncome" data-options="label:'收入：',increment:1,min:1,suffix:'K ',required:true"  style="width:180px;">
        </div>
        <div style="margin-bottom:20px">
            <input id="memLiveRegionCode1" name="memLiveRegionCode1" value="" style="width:230px" />
            <input id="memLiveRegionCode2" name="memLiveRegionCode2" value="" style="width:230px" />
            <input id="memLiveRegionCode3" name="memLiveRegionCode3" value="" style="width:230px" />
        </div>
        <div style="margin-bottom:20px">
            <input id="memCensusRegionCode1" name="memCensusRegionCode1" value="" style="width:230px" />
            <input id="memCensusRegionCode2" name="memCensusRegionCode2" value="" style="width:230px" />
            <input id="memCensusRegionCode3" name="memCensusRegionCode3" value="" style="width:230px" />
        </div>
        <div style="margin-bottom: 20px">
            <label class="textbox-label textbox-label-before" for="_easyui_textbox_input3" style="text-align: left; height: 30px; line-height: 30px;">资产：</label>
            <select class="easyui-combobox" name="memHouse" data-options="editable:false" style="width:100px;">
                <option value="无">无房</option>
                <option value="有">有房</option>
            </select>
            <select class="easyui-combobox" name="memCar" data-options="editable:false" style="width:100px;">
                <option value="无">无车</option>
                <option value="有">有车</option>
            </select>
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" name="memRequirement" style="width:70%" data-options="label:'要求：'" />
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-tagbox" name="memLabelIds" style="width:70%" data-options="label:'标签：',required:true,missingMessage:'标签不可以为空',invalidMessage:'标签不可以为空',method:'post',limitToList:true,hasDownArrow:true,valueField:'memLabelId',textField:'memLabelName',prompt:'选择生活标签',editable:false,url:'{{.baseUrl}}/agent/basefun/findMemLabels'" />
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" name="memEvaluation" data-options="label:'自我介绍：',labelPosition:'top',multiline:'true'" style="width:100%;height:120px" />
        </div>
        <div style="margin-bottom:20px">
            <a href="javascript:void(0)" class="easyui-linkbutton" id="btn_submit" style="width:100px; border-color: #4cae4c; background-image: linear-gradient(rgb(76,174,76) 0px, rgb(68,157,68) 100%);">添加会员</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" id="btn_clear" style="width:100px;">重新填写</a>
        </div>
        {{if .msg}}
            <div style="margin-bottom:20px; font-weight: bold; font-size: 36px; color: red;">
                {{.msg}}
            </div>
        {{end}}
    </form>
</body>
</html>
{{template "inc/easyui_js.html" .}}
<script type="text/javascript" src="{{.staticResourceUrl}}/js/easyui_validate.js"></script>
<script type="text/javascript" charset="UTF-8">
    var serverBaseUrl='{{.baseUrl}}';
    $(document).ready(function(){
        var allHeight=document.documentElement.clientHeight;
        allHeight-=20;
        document.body.style.height = allHeight+"px";
        var memLiveRegionCode1_val="";
        var memLiveRegionCode2_val="";
        var rel_memLiveRegionCode3=function(){
            $("#memLiveRegionCode3").combobox({
                method:'post',
                url:"{{.baseUrl}}/agent/basefun/findRegions",
                valueField:"RegionCode",
                textField:"RegionName",
                required:true,
                validType:'regionval',
                editable:false,
                missingMessage:'请选择居住地',
                invalidMessage:'请选择居住地',
                queryParams:{"lve":3,"regionCode":memLiveRegionCode2_val}
            });
            $("#memLiveRegionCode3").combobox('disableValidation');
        };
        var rel_memLiveRegionCode2=function(){
            $("#memLiveRegionCode2").combobox({
                method:'post',
                url:"{{.baseUrl}}/agent/basefun/findRegions",
                valueField:"RegionCode",
                textField:"RegionName",
                editable:false,
                required:true,
                validType:'regionval',
                missingMessage:'请选择居住地',
                invalidMessage:'请选择居住地',
                queryParams:{"lve":2,"regionCode":memLiveRegionCode1_val},
                onSelect:function(rec){
                    memLiveRegionCode2_val=rec.RegionCode;
                    if(memLiveRegionCode2_val==""){
                        return;
                    }
                    rel_memLiveRegionCode3();
                }
            });
            $("#memLiveRegionCode2").combobox('disableValidation');
        };
        //居住地第一级
        $("#memLiveRegionCode1").combobox({
            label:'居住地：',
            method:'post',
            url:"{{.baseUrl}}/agent/basefun/findRegions",
            valueField:"RegionCode",
            textField:"RegionName",
            editable:false,
            required:true,
            validType:'regionval',
            missingMessage:'请选择居住地',
            invalidMessage:'1请选择居住地',
            queryParams:{"lve":1},
            onSelect:function(rec){
                memLiveRegionCode1_val=rec.RegionCode;
                if(memLiveRegionCode1_val==""){
                    return;
                }
                rel_memLiveRegionCode2();
            }
        });
        $("#memLiveRegionCode1").combobox('disableValidation');
        rel_memLiveRegionCode2();
        rel_memLiveRegionCode3();

        var memCensusRegionCode1_val="";
        var memCensusRegionCode2_val="";
        var rel_memCensusRegionCode3=function(){
            $("#memCensusRegionCode3").combobox({
                method:'post',
                url:"{{.baseUrl}}/agent/basefun/findRegions",
                valueField:"RegionCode",
                textField:"RegionName",
                required:true,
                validType:'regionval',
                editable:false,
                missingMessage:'请选择户籍地',
                invalidMessage:'请选择户籍地',
                queryParams:{"lve":3,"regionCode":memCensusRegionCode2_val}
            });
            $("#memCensusRegionCode3").combobox('disableValidation');
        };
        var rel_memCensusRegionCode2=function(){
            $("#memCensusRegionCode2").combobox({
                method:'post',
                url:"{{.baseUrl}}/agent/basefun/findRegions",
                valueField:"RegionCode",
                textField:"RegionName",
                editable:false,
                required:true,
                validType:'regionval',
                missingMessage:'请选择户籍地',
                invalidMessage:'请选择户籍地',
                queryParams:{"lve":2,"regionCode":memCensusRegionCode1_val},
                onSelect:function(rec){
                    memCensusRegionCode2_val=rec.RegionCode;
                    if(memCensusRegionCode2_val==""){
                        return;
                    }
                    rel_memCensusRegionCode3();
                }
            });
            $("#memCensusRegionCode2").combobox('disableValidation');
        };
        //户籍地第一级
        $("#memCensusRegionCode1").combobox({
            label:'户籍地：',
            method:'post',
            url:"{{.baseUrl}}/agent/basefun/findRegions",
            valueField:"RegionCode",
            textField:"RegionName",
            editable:false,
            required:true,
            validType:'regionval',
            missingMessage:'请选择户籍地',
            invalidMessage:'1请选择户籍地',
            queryParams:{"lve":1},
            onSelect:function(rec){
                memCensusRegionCode1_val=rec.RegionCode;
                if(memCensusRegionCode1_val==""){
                    return;
                }
                rel_memCensusRegionCode2();
            }
        });
        $("#memCensusRegionCode1").combobox('disableValidation');
        rel_memCensusRegionCode2();
        rel_memCensusRegionCode3();
        $("#btn_submit").click(function(){
            $("#memLiveRegionCode1").combobox('enableValidation');
            $("#memLiveRegionCode2").combobox('enableValidation');
            $("#memLiveRegionCode3").combobox('enableValidation');

            $("#memCensusRegionCode1").combobox('enableValidation');
            $("#memCensusRegionCode2").combobox('enableValidation');
            $("#memCensusRegionCode3").combobox('enableValidation');
            $('#ff').form('submit',{
                onSubmit:function(){
                    return $(this).form('enableValidation').form('validate');
                }
            });
        });
        $("#btn_clear").click(function(){
            $("#memLiveRegionCode1").combobox('disableValidation');
            $("#memLiveRegionCode2").combobox('disableValidation');
            $("#memLiveRegionCode3").combobox('disableValidation');

            $("#memCensusRegionCode1").combobox('disableValidation');
            $("#memCensusRegionCode2").combobox('disableValidation');
            $("#memCensusRegionCode3").combobox('disableValidation');
            $("#ff").form({
                novalidate:true
            });
            $("#ff").form("clear");
        });

        $("#panel_img").panel('open');
    });
</script>
